<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>VueComponent学习</title>
    <script src="../commonjs/vue.js"></script>
</head>
<body>
    <div id="root">
        <school></school>
    </div>
    <script>
        Vue.config.productionTip = false;//关闭开发提示
        const school = Vue.extend({
            template:`
                <div>
                  <h2>学校名称:{{name}}</h2>
                  <h2>学校地址:{{address}}</h2>
                  <button @click="showName">点我显示学校名称</button>
                </div>
            `,
            data(){
                return{
                    name:'武威职业学院',
                    address:'武威市凉州区皇台路102号'
                }
            },
            methods:{
                showName(){
                    console.log("showName:",this) //this: VueComponent
                }
            }
        })
        new Vue({
            el:'#root',
            components:{
                school
            }
        })
    </script>
</body>
</html>